# coding: utf-8
import demo_common
from gensim import models


def get_hdp_model(corpus, dictionary):
    return models.HdpModel(corpus=corpus, id2word=dictionary)


if __name__ == '__main__':
    num_topics = 10
    train_set = demo_common.get_train_set()
    print('train_set len', len(train_set))
    dictionary = demo_common.get_dictionary(train_set)
    corpus = demo_common.get_bow_corpus(dictionary=dictionary, train_set=train_set)
    tfidf = demo_common.get_tfidf_model(dictionary=dictionary, corpus=corpus)
    corpus_tfidf = tfidf[corpus]
    hdp = get_hdp_model(corpus=corpus, dictionary=dictionary)
    for item in hdp.show_topics():
        print(item)
